package com.zyz.M_File和IO流.File类.构造器;

import java.io.File;

/**
 * @author: vick
 * @Date: 2025/4/7
 * @Description:
 * @version: 1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        String pathName1 = "D:\\a.txt";
        File file1 = new File(pathName1);

        //通过文件路径名
        String pathName2 = "D:\\aa\\a.txt";
        File file2 = new File(pathName2);
        System.out.println(file2);

        //通过父路径和子路径
        String parent = "D:\\aa";
        String child = "a.txt";
        File file3 = new File(parent, child);
        System.out.println(file3);

        //通过父级File对象和子路径
        File parentDir = new File("D:\\aa");
        String childFile = "a.txt";
        File file4 = new File(parentDir, childFile);
        System.out.println(file4);
    }
}
